using SM.core;
using SS;
using SS.core;
using System;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Windows.Forms;
using TVSBH.core;
namespace TVSBH.func
{
	public class frmLogOutputRetail : Form
	{
		private IContainer components = null;
		private DataGridView dgvBill;
		private Button btnClose;
		private Button btnPrint;
		private GroupBox groupBox1;
		private TextBox txtTotalMoney;
		private Label label7;
		private Label label2;
		private DateTimePicker txtDate;
		private TextBox txtID;
		private Label label1;
		private Label label3;
		private TextBox txtName;
		private ComboBox cbbSex;
		private Label label4;
		private TextBox txtAge;
		private Label label5;
		private Label label6;
		private Label label8;
		private TextBox txtAddress;
		private TextBox txtPhone;
		private TextBox txtNote;
		private Label label9;
		private GroupBox groupBox2;
		private Button btnSelect;
		private Button btnAddToBill;
		private DateTimePicker dptProductExpiryDate;
		private Label label16;
		private DateTimePicker dtpProductDate;
		private Label label15;
		private Label label14;
		private TextBox txtProductPrice;
		private Label label13;
		private TextBox txtProductMoney;
		private Label label12;
		private TextBox txtProductNumber;
		private Label label11;
		private TextBox txtProductUnit;
		private Label label10;
		private TextBox txtProductName;
		private Label label18;
		private ComboBox cbbPacket;
		private Label label19;
		private TextBox textBox1;
		private GroupBox groupBox3;
		private Label label25;
		private Label label17;
		private Button btnSearchTime;
		private DateTimePicker dtpTo;
		private DateTimePicker dtpFrom;
		private DataGridView dgvProduct;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
		private DataGridViewTextBoxColumn dataGridViewTextBoxColumn7;
		private DataGridViewTextBoxColumn Column10;
		private DataGridViewTextBoxColumn Column11;
		private DataGridViewTextBoxColumn Column12;
		private DataGridViewTextBoxColumn Column13;
		private DataGridViewTextBoxColumn Column14;
		private DataGridViewTextBoxColumn Column15;
		private DataGridViewTextBoxColumn Column16;
		private DataGridViewTextBoxColumn Column17;
		private DataGridViewTextBoxColumn Column18;
		private DataGridViewTextBoxColumn Column19;
		private DataGridViewTextBoxColumn Column24;
		private DataGridViewTextBoxColumn Column25;
		private DataGridViewTextBoxColumn Column26;
		private Label label20;
		private Label lblSumMoney;
		private DataGridViewTextBoxColumn Column2;
		private DataGridViewTextBoxColumn Column1;
		private DataGridViewTextBoxColumn Column3;
		private DataGridViewTextBoxColumn Column4;
		private DataGridViewTextBoxColumn Column5;
		private DataGridViewTextBoxColumn Column6;
		private DataGridViewTextBoxColumn Column7;
		private DataGridViewTextBoxColumn Column8;
		private DataGridViewTextBoxColumn Column9;
		private DataGridViewTextBoxColumn Column20;
		private DataGridViewTextBoxColumn Column21;
		private DataGridViewTextBoxColumn Column22;
		private DataGridViewTextBoxColumn Column23;
		private Func objFunc = new Func();
		private DataTable objTable = new DataTable();
		private DataTable objTableBill = new DataTable();
		private Bill objBill = new Bill();
		private Partner objPartner = new Partner();
		private string currPid = "";
		private string cusID = "";
		private customers objCus = new customers();
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			DataGridViewCellStyle dataGridViewCellStyle = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle4 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle5 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle6 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle7 = new DataGridViewCellStyle();
			DataGridViewCellStyle dataGridViewCellStyle8 = new DataGridViewCellStyle();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(frmLogOutputRetail));
			this.dgvBill = new DataGridView();
			this.dataGridViewTextBoxColumn1 = new DataGridViewTextBoxColumn();
			this.dataGridViewTextBoxColumn7 = new DataGridViewTextBoxColumn();
			this.Column10 = new DataGridViewTextBoxColumn();
			this.Column11 = new DataGridViewTextBoxColumn();
			this.Column12 = new DataGridViewTextBoxColumn();
			this.Column13 = new DataGridViewTextBoxColumn();
			this.Column14 = new DataGridViewTextBoxColumn();
			this.Column15 = new DataGridViewTextBoxColumn();
			this.Column16 = new DataGridViewTextBoxColumn();
			this.Column17 = new DataGridViewTextBoxColumn();
			this.Column18 = new DataGridViewTextBoxColumn();
			this.Column19 = new DataGridViewTextBoxColumn();
			this.Column24 = new DataGridViewTextBoxColumn();
			this.Column25 = new DataGridViewTextBoxColumn();
			this.Column26 = new DataGridViewTextBoxColumn();
			this.btnClose = new Button();
			this.btnPrint = new Button();
			this.dgvProduct = new DataGridView();
			this.Column2 = new DataGridViewTextBoxColumn();
			this.Column1 = new DataGridViewTextBoxColumn();
			this.Column3 = new DataGridViewTextBoxColumn();
			this.Column4 = new DataGridViewTextBoxColumn();
			this.Column5 = new DataGridViewTextBoxColumn();
			this.Column6 = new DataGridViewTextBoxColumn();
			this.Column7 = new DataGridViewTextBoxColumn();
			this.Column8 = new DataGridViewTextBoxColumn();
			this.Column9 = new DataGridViewTextBoxColumn();
			this.Column20 = new DataGridViewTextBoxColumn();
			this.Column21 = new DataGridViewTextBoxColumn();
			this.Column22 = new DataGridViewTextBoxColumn();
			this.Column23 = new DataGridViewTextBoxColumn();
			this.groupBox1 = new GroupBox();
			this.txtNote = new TextBox();
			this.label9 = new Label();
			this.txtPhone = new TextBox();
			this.label8 = new Label();
			this.txtAddress = new TextBox();
			this.label6 = new Label();
			this.txtAge = new TextBox();
			this.label5 = new Label();
			this.cbbSex = new ComboBox();
			this.label4 = new Label();
			this.txtName = new TextBox();
			this.label3 = new Label();
			this.txtTotalMoney = new TextBox();
			this.label7 = new Label();
			this.label2 = new Label();
			this.txtDate = new DateTimePicker();
			this.txtID = new TextBox();
			this.label1 = new Label();
			this.groupBox2 = new GroupBox();
			this.textBox1 = new TextBox();
			this.label19 = new Label();
			this.cbbPacket = new ComboBox();
			this.btnSelect = new Button();
			this.btnAddToBill = new Button();
			this.dptProductExpiryDate = new DateTimePicker();
			this.label16 = new Label();
			this.dtpProductDate = new DateTimePicker();
			this.label15 = new Label();
			this.label14 = new Label();
			this.txtProductPrice = new TextBox();
			this.label13 = new Label();
			this.txtProductMoney = new TextBox();
			this.label12 = new Label();
			this.txtProductNumber = new TextBox();
			this.label11 = new Label();
			this.txtProductUnit = new TextBox();
			this.label10 = new Label();
			this.txtProductName = new TextBox();
			this.label18 = new Label();
			this.groupBox3 = new GroupBox();
			this.label25 = new Label();
			this.label17 = new Label();
			this.btnSearchTime = new Button();
			this.dtpTo = new DateTimePicker();
			this.dtpFrom = new DateTimePicker();
			this.label20 = new Label();
			this.lblSumMoney = new Label();
			((ISupportInitialize)this.dgvBill).BeginInit();
			((ISupportInitialize)this.dgvProduct).BeginInit();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.groupBox3.SuspendLayout();
			base.SuspendLayout();
			this.dgvBill.AllowUserToAddRows = false;
			this.dgvBill.AllowUserToDeleteRows = false;
			this.dgvBill.AllowUserToOrderColumns = true;
			this.dgvBill.AllowUserToResizeColumns = false;
			this.dgvBill.AllowUserToResizeRows = false;
			dataGridViewCellStyle.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvBill.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle;
			this.dgvBill.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left);
			this.dgvBill.BackgroundColor = Color.White;
			this.dgvBill.BorderStyle = BorderStyle.Fixed3D;
			this.dgvBill.ColumnHeadersHeight = 25;
			this.dgvBill.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvBill.Columns.AddRange(new DataGridViewColumn[]
			{
				this.dataGridViewTextBoxColumn1,
				this.dataGridViewTextBoxColumn7,
				this.Column10,
				this.Column11,
				this.Column12,
				this.Column13,
				this.Column14,
				this.Column15,
				this.Column16,
				this.Column17,
				this.Column18,
				this.Column19,
				this.Column24,
				this.Column25,
				this.Column26
			});
			this.dgvBill.Cursor = Cursors.Hand;
			this.dgvBill.EnableHeadersVisualStyles = false;
			this.dgvBill.Location = new System.Drawing.Point(7, 118);
			this.dgvBill.MultiSelect = false;
			this.dgvBill.Name = "dgvBill";
			this.dgvBill.ReadOnly = true;
			this.dgvBill.RowHeadersVisible = false;
			this.dgvBill.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			this.dgvBill.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvBill.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvBill.Size = new Size(220, 442);
			this.dgvBill.TabIndex = 41;
			this.dgvBill.CellEnter += new DataGridViewCellEventHandler(this.dgvBill_CellEnter);
			this.dataGridViewTextBoxColumn1.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.dataGridViewTextBoxColumn1.DataPropertyName = "ID";
			this.dataGridViewTextBoxColumn1.HeaderText = "Hoá đơn";
			this.dataGridViewTextBoxColumn1.MinimumWidth = 120;
			this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
			this.dataGridViewTextBoxColumn1.ReadOnly = true;
			this.dataGridViewTextBoxColumn7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.dataGridViewTextBoxColumn7.DataPropertyName = "CreateDate";
			dataGridViewCellStyle2.Format = "D";
			dataGridViewCellStyle2.NullValue = null;
			this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle2;
			this.dataGridViewTextBoxColumn7.HeaderText = "Ngày lập";
			this.dataGridViewTextBoxColumn7.MinimumWidth = 80;
			this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
			this.dataGridViewTextBoxColumn7.ReadOnly = true;
			this.dataGridViewTextBoxColumn7.Width = 80;
			this.Column10.DataPropertyName = "TotalMoney";
			this.Column10.HeaderText = "TotalMoney";
			this.Column10.Name = "Column10";
			this.Column10.ReadOnly = true;
			this.Column10.Visible = false;
			this.Column11.DataPropertyName = "TypeInput";
			this.Column11.HeaderText = "TypeInput";
			this.Column11.Name = "Column11";
			this.Column11.ReadOnly = true;
			this.Column11.Visible = false;
			this.Column12.DataPropertyName = "WID";
			this.Column12.HeaderText = "WID";
			this.Column12.Name = "Column12";
			this.Column12.ReadOnly = true;
			this.Column12.Visible = false;
			this.Column13.DataPropertyName = "Note";
			this.Column13.HeaderText = "Note";
			this.Column13.Name = "Column13";
			this.Column13.ReadOnly = true;
			this.Column13.Visible = false;
			this.Column14.DataPropertyName = "PID";
			this.Column14.HeaderText = "PID";
			this.Column14.Name = "Column14";
			this.Column14.ReadOnly = true;
			this.Column14.Visible = false;
			this.Column15.HeaderText = "Tên khách hàng";
			this.Column15.Name = "Column15";
			this.Column15.ReadOnly = true;
			this.Column15.Visible = false;
			this.Column16.HeaderText = "Tuổi";
			this.Column16.Name = "Column16";
			this.Column16.ReadOnly = true;
			this.Column16.Visible = false;
			this.Column17.HeaderText = "Giới tính";
			this.Column17.Name = "Column17";
			this.Column17.ReadOnly = true;
			this.Column17.Visible = false;
			this.Column18.HeaderText = "Địa chỉ";
			this.Column18.Name = "Column18";
			this.Column18.ReadOnly = true;
			this.Column18.Visible = false;
			this.Column19.HeaderText = "Điện thoại";
			this.Column19.Name = "Column19";
			this.Column19.ReadOnly = true;
			this.Column19.Visible = false;
			this.Column24.DataPropertyName = "UserName";
			this.Column24.HeaderText = "UserName";
			this.Column24.Name = "Column24";
			this.Column24.ReadOnly = true;
			this.Column24.Visible = false;
			this.Column25.DataPropertyName = "FullName";
			this.Column25.HeaderText = "FullName";
			this.Column25.Name = "Column25";
			this.Column25.ReadOnly = true;
			this.Column25.Visible = false;
			this.Column26.DataPropertyName = "Printed";
			this.Column26.HeaderText = "Printed";
			this.Column26.Name = "Column26";
			this.Column26.ReadOnly = true;
			this.Column26.Visible = false;
			this.btnClose.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.btnClose.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnClose.FlatStyle = FlatStyle.Flat;
			this.btnClose.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnClose.Location = new System.Drawing.Point(784, 565);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new Size(109, 26);
			this.btnClose.TabIndex = 48;
			this.btnClose.Text = "Thoát  [ ESC ]";
			this.btnClose.UseVisualStyleBackColor = true;
			this.btnClose.Click += new EventHandler(this.btnClose_Click);
			this.btnPrint.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.btnPrint.Enabled = false;
			this.btnPrint.FlatAppearance.BorderColor = Color.FromArgb(255, 128, 255);
			this.btnPrint.FlatStyle = FlatStyle.Flat;
			this.btnPrint.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnPrint.Location = new System.Drawing.Point(233, 568);
			this.btnPrint.Name = "btnPrint";
			this.btnPrint.Size = new Size(114, 26);
			this.btnPrint.TabIndex = 46;
			this.btnPrint.Text = "Xem và in  [ F7 ]";
			this.btnPrint.UseVisualStyleBackColor = true;
			this.btnPrint.Click += new EventHandler(this.btnPrint_Click);
			this.dgvProduct.AllowUserToAddRows = false;
			this.dgvProduct.AllowUserToDeleteRows = false;
			this.dgvProduct.AllowUserToOrderColumns = true;
			this.dgvProduct.AllowUserToResizeColumns = false;
			this.dgvProduct.AllowUserToResizeRows = false;
			dataGridViewCellStyle3.BackColor = Color.FromArgb(192, 255, 255);
			dataGridViewCellStyle3.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
			this.dgvProduct.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
			this.dgvProduct.BackgroundColor = Color.White;
			this.dgvProduct.BorderStyle = BorderStyle.Fixed3D;
			this.dgvProduct.ColumnHeadersHeight = 25;
			this.dgvProduct.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
			this.dgvProduct.Columns.AddRange(new DataGridViewColumn[]
			{
				this.Column2,
				this.Column1,
				this.Column3,
				this.Column4,
				this.Column5,
				this.Column6,
				this.Column7,
				this.Column8,
				this.Column9,
				this.Column20,
				this.Column21,
				this.Column22,
				this.Column23
			});
			this.dgvProduct.Cursor = Cursors.Hand;
			this.dgvProduct.EnableHeadersVisualStyles = false;
			this.dgvProduct.Location = new System.Drawing.Point(233, 118);
			this.dgvProduct.MultiSelect = false;
			this.dgvProduct.Name = "dgvProduct";
			this.dgvProduct.ReadOnly = true;
			this.dgvProduct.RowHeadersVisible = false;
			this.dgvProduct.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing;
			this.dgvProduct.RowTemplate.DefaultCellStyle.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.dgvProduct.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
			this.dgvProduct.Size = new Size(660, 442);
			this.dgvProduct.TabIndex = 49;
			this.dgvProduct.CellEnter += new DataGridViewCellEventHandler(this.dgvProduct_CellEnter);
			this.Column2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
			this.Column2.DataPropertyName = "productName";
			this.Column2.HeaderText = "Sản phẩm";
			this.Column2.Name = "Column2";
			this.Column2.ReadOnly = true;
			this.Column1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column1.DataPropertyName = "Packet";
			this.Column1.HeaderText = "Số lô";
			this.Column1.MinimumWidth = 120;
			this.Column1.Name = "Column1";
			this.Column1.ReadOnly = true;
			this.Column1.Width = 120;
			this.Column3.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column3.DataPropertyName = "productUnit";
			this.Column3.HeaderText = "Đơn vị tính";
			this.Column3.MinimumWidth = 110;
			this.Column3.Name = "Column3";
			this.Column3.ReadOnly = true;
			this.Column3.Width = 110;
			this.Column4.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column4.DataPropertyName = "productNumber";
			dataGridViewCellStyle4.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle4.Format = "N0";
			dataGridViewCellStyle4.NullValue = null;
			this.Column4.DefaultCellStyle = dataGridViewCellStyle4;
			this.Column4.HeaderText = "Số lượng";
			this.Column4.MinimumWidth = 85;
			this.Column4.Name = "Column4";
			this.Column4.ReadOnly = true;
			this.Column4.Width = 85;
			this.Column5.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column5.DataPropertyName = "productPrice2";
			dataGridViewCellStyle5.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle5.Format = "N0";
			dataGridViewCellStyle5.NullValue = null;
			this.Column5.DefaultCellStyle = dataGridViewCellStyle5;
			this.Column5.HeaderText = "Đơn giá";
			this.Column5.MinimumWidth = 80;
			this.Column5.Name = "Column5";
			this.Column5.ReadOnly = true;
			this.Column5.Width = 80;
			this.Column6.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column6.DataPropertyName = "ProductMoney";
			dataGridViewCellStyle6.Alignment = DataGridViewContentAlignment.MiddleRight;
			dataGridViewCellStyle6.Format = "N0";
			dataGridViewCellStyle6.NullValue = null;
			this.Column6.DefaultCellStyle = dataGridViewCellStyle6;
			this.Column6.HeaderText = "Thành tiền";
			this.Column6.MinimumWidth = 90;
			this.Column6.Name = "Column6";
			this.Column6.ReadOnly = true;
			this.Column6.Width = 90;
			this.Column7.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column7.DataPropertyName = "ProductDate";
			dataGridViewCellStyle7.Format = "dd/MM/yyyy";
			this.Column7.DefaultCellStyle = dataGridViewCellStyle7;
			this.Column7.HeaderText = "Ngày SX";
			this.Column7.MinimumWidth = 80;
			this.Column7.Name = "Column7";
			this.Column7.ReadOnly = true;
			this.Column7.Visible = false;
			this.Column7.Width = 80;
			this.Column8.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column8.DataPropertyName = "ProductExpiryDate";
			dataGridViewCellStyle8.Format = "dd/MM/yyyy";
			this.Column8.DefaultCellStyle = dataGridViewCellStyle8;
			this.Column8.HeaderText = "Hạn dùng";
			this.Column8.MinimumWidth = 90;
			this.Column8.Name = "Column8";
			this.Column8.ReadOnly = true;
			this.Column8.Visible = false;
			this.Column8.Width = 90;
			this.Column9.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
			this.Column9.DataPropertyName = "Pid";
			this.Column9.HeaderText = "Mã sản phẩm";
			this.Column9.Name = "Column9";
			this.Column9.ReadOnly = true;
			this.Column9.Visible = false;
			this.Column20.DataPropertyName = "productPrice1";
			this.Column20.HeaderText = "Column20";
			this.Column20.Name = "Column20";
			this.Column20.ReadOnly = true;
			this.Column20.Visible = false;
			this.Column21.DataPropertyName = "productPrice";
			this.Column21.HeaderText = "Column21";
			this.Column21.Name = "Column21";
			this.Column21.ReadOnly = true;
			this.Column21.Visible = false;
			this.Column22.DataPropertyName = "NationalID";
			this.Column22.HeaderText = "Column22";
			this.Column22.Name = "Column22";
			this.Column22.ReadOnly = true;
			this.Column22.Visible = false;
			this.Column23.DataPropertyName = "VAT";
			this.Column23.HeaderText = "Column23";
			this.Column23.Name = "Column23";
			this.Column23.ReadOnly = true;
			this.Column23.Visible = false;
			this.groupBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.groupBox1.Controls.Add(this.txtNote);
			this.groupBox1.Controls.Add(this.label9);
			this.groupBox1.Controls.Add(this.txtPhone);
			this.groupBox1.Controls.Add(this.label8);
			this.groupBox1.Controls.Add(this.txtAddress);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Controls.Add(this.txtAge);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.cbbSex);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.txtName);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.txtTotalMoney);
			this.groupBox1.Controls.Add(this.label7);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.txtDate);
			this.groupBox1.Controls.Add(this.txtID);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Enabled = false;
			this.groupBox1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.groupBox1.Location = new System.Drawing.Point(233, 5);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new Size(660, 107);
			this.groupBox1.TabIndex = 50;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Thông tin hoá đơn";
			this.txtNote.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtNote.BackColor = Color.White;
			this.txtNote.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtNote.Location = new System.Drawing.Point(292, 76);
			this.txtNote.Name = "txtNote";
			this.txtNote.ReadOnly = true;
			this.txtNote.Size = new Size(359, 22);
			this.txtNote.TabIndex = 33;
			this.label9.AutoSize = true;
			this.label9.BackColor = Color.White;
			this.label9.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label9.ForeColor = Color.Black;
			this.label9.Location = new System.Drawing.Point(233, 79);
			this.label9.Name = "label9";
			this.label9.Size = new Size(55, 15);
			this.label9.TabIndex = 32;
			this.label9.Text = "Ghi chú :";
			this.label9.TextAlign = ContentAlignment.MiddleRight;
			this.txtPhone.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.txtPhone.BackColor = Color.White;
			this.txtPhone.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtPhone.Location = new System.Drawing.Point(512, 47);
			this.txtPhone.Name = "txtPhone";
			this.txtPhone.ReadOnly = true;
			this.txtPhone.Size = new Size(139, 22);
			this.txtPhone.TabIndex = 31;
			this.label8.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.label8.AutoSize = true;
			this.label8.BackColor = Color.White;
			this.label8.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label8.ForeColor = Color.Black;
			this.label8.Location = new System.Drawing.Point(438, 50);
			this.label8.Name = "label8";
			this.label8.Size = new Size(70, 15);
			this.label8.TabIndex = 30;
			this.label8.Text = "Điện thoại :";
			this.label8.TextAlign = ContentAlignment.MiddleRight;
			this.txtAddress.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtAddress.BackColor = Color.White;
			this.txtAddress.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtAddress.Location = new System.Drawing.Point(292, 47);
			this.txtAddress.Name = "txtAddress";
			this.txtAddress.ReadOnly = true;
			this.txtAddress.Size = new Size(132, 22);
			this.txtAddress.TabIndex = 29;
			this.label6.AutoSize = true;
			this.label6.BackColor = Color.White;
			this.label6.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label6.ForeColor = Color.Black;
			this.label6.Location = new System.Drawing.Point(236, 50);
			this.label6.Name = "label6";
			this.label6.Size = new Size(52, 15);
			this.label6.TabIndex = 28;
			this.label6.Text = "Địa chỉ :";
			this.label6.TextAlign = ContentAlignment.MiddleRight;
			this.txtAge.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.txtAge.BackColor = Color.White;
			this.txtAge.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtAge.Location = new System.Drawing.Point(473, 19);
			this.txtAge.Name = "txtAge";
			this.txtAge.ReadOnly = true;
			this.txtAge.Size = new Size(36, 22);
			this.txtAge.TabIndex = 27;
			this.txtAge.TextAlign = HorizontalAlignment.Right;
			this.label5.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.label5.AutoSize = true;
			this.label5.BackColor = Color.White;
			this.label5.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label5.ForeColor = Color.Black;
			this.label5.Location = new System.Drawing.Point(433, 22);
			this.label5.Name = "label5";
			this.label5.Size = new Size(36, 15);
			this.label5.TabIndex = 26;
			this.label5.Text = "Tuổi :";
			this.label5.TextAlign = ContentAlignment.MiddleRight;
			this.cbbSex.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.cbbSex.BackColor = Color.White;
			this.cbbSex.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbSex.FlatStyle = FlatStyle.Flat;
			this.cbbSex.Font = new Font("Arial", 7.5f);
			this.cbbSex.FormattingEnabled = true;
			this.cbbSex.Items.AddRange(new object[]
			{
				"Nam",
				"Nữ"
			});
			this.cbbSex.Location = new System.Drawing.Point(581, 18);
			this.cbbSex.Name = "cbbSex";
			this.cbbSex.Size = new Size(70, 21);
			this.cbbSex.TabIndex = 25;
			this.label4.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.label4.AutoSize = true;
			this.label4.BackColor = Color.White;
			this.label4.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label4.ForeColor = Color.Black;
			this.label4.Location = new System.Drawing.Point(516, 22);
			this.label4.Name = "label4";
			this.label4.Size = new Size(60, 15);
			this.label4.TabIndex = 24;
			this.label4.Text = "Giới tính :";
			this.label4.TextAlign = ContentAlignment.MiddleRight;
			this.txtName.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtName.BackColor = Color.White;
			this.txtName.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtName.Location = new System.Drawing.Point(292, 19);
			this.txtName.Name = "txtName";
			this.txtName.ReadOnly = true;
			this.txtName.Size = new Size(132, 22);
			this.txtName.TabIndex = 23;
			this.label3.AutoSize = true;
			this.label3.BackColor = Color.White;
			this.label3.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label3.ForeColor = Color.Black;
			this.label3.Location = new System.Drawing.Point(208, 22);
			this.label3.Name = "label3";
			this.label3.Size = new Size(80, 15);
			this.label3.TabIndex = 22;
			this.label3.Text = "Khách hàng :";
			this.label3.TextAlign = ContentAlignment.MiddleRight;
			this.txtTotalMoney.BackColor = Color.White;
			this.txtTotalMoney.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtTotalMoney.Location = new System.Drawing.Point(101, 76);
			this.txtTotalMoney.Name = "txtTotalMoney";
			this.txtTotalMoney.ReadOnly = true;
			this.txtTotalMoney.Size = new Size(100, 22);
			this.txtTotalMoney.TabIndex = 21;
			this.txtTotalMoney.Text = "0";
			this.txtTotalMoney.TextAlign = HorizontalAlignment.Right;
			this.label7.AutoSize = true;
			this.label7.BackColor = Color.White;
			this.label7.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label7.ForeColor = Color.Black;
			this.label7.Location = new System.Drawing.Point(32, 79);
			this.label7.Name = "label7";
			this.label7.Size = new Size(65, 15);
			this.label7.TabIndex = 20;
			this.label7.Text = "Tổng tiền :";
			this.label7.TextAlign = ContentAlignment.MiddleRight;
			this.label2.AutoSize = true;
			this.label2.BackColor = Color.White;
			this.label2.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label2.ForeColor = Color.Black;
			this.label2.Location = new System.Drawing.Point(28, 50);
			this.label2.Name = "label2";
			this.label2.Size = new Size(69, 15);
			this.label2.TabIndex = 19;
			this.label2.Text = "Ngày xuất :";
			this.label2.TextAlign = ContentAlignment.MiddleRight;
			this.txtDate.CustomFormat = "dd/MM/yyyy";
			this.txtDate.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtDate.Format = DateTimePickerFormat.Custom;
			this.txtDate.Location = new System.Drawing.Point(101, 47);
			this.txtDate.Name = "txtDate";
			this.txtDate.Size = new Size(100, 22);
			this.txtDate.TabIndex = 18;
			this.txtID.BackColor = Color.White;
			this.txtID.CharacterCasing = CharacterCasing.Upper;
			this.txtID.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.txtID.Location = new System.Drawing.Point(101, 19);
			this.txtID.Name = "txtID";
			this.txtID.ReadOnly = true;
			this.txtID.Size = new Size(100, 22);
			this.txtID.TabIndex = 17;
			this.label1.AutoSize = true;
			this.label1.BackColor = Color.White;
			this.label1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label1.ForeColor = Color.Black;
			this.label1.Location = new System.Drawing.Point(28, 22);
			this.label1.Name = "label1";
			this.label1.Size = new Size(69, 15);
			this.label1.TabIndex = 16;
			this.label1.Text = "Đơn hàng :";
			this.label1.TextAlign = ContentAlignment.MiddleRight;
			this.groupBox2.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.groupBox2.Controls.Add(this.textBox1);
			this.groupBox2.Controls.Add(this.label19);
			this.groupBox2.Controls.Add(this.cbbPacket);
			this.groupBox2.Controls.Add(this.btnSelect);
			this.groupBox2.Controls.Add(this.btnAddToBill);
			this.groupBox2.Controls.Add(this.dptProductExpiryDate);
			this.groupBox2.Controls.Add(this.label16);
			this.groupBox2.Controls.Add(this.dtpProductDate);
			this.groupBox2.Controls.Add(this.label15);
			this.groupBox2.Controls.Add(this.label14);
			this.groupBox2.Controls.Add(this.txtProductPrice);
			this.groupBox2.Controls.Add(this.label13);
			this.groupBox2.Controls.Add(this.txtProductMoney);
			this.groupBox2.Controls.Add(this.label12);
			this.groupBox2.Controls.Add(this.txtProductNumber);
			this.groupBox2.Controls.Add(this.label11);
			this.groupBox2.Controls.Add(this.txtProductUnit);
			this.groupBox2.Controls.Add(this.label10);
			this.groupBox2.Controls.Add(this.txtProductName);
			this.groupBox2.Controls.Add(this.label18);
			this.groupBox2.Location = new System.Drawing.Point(233, 118);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new Size(660, 142);
			this.groupBox2.TabIndex = 51;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "Sản phần cần nhập";
			this.textBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.textBox1.BackColor = Color.White;
			this.textBox1.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.textBox1.Location = new System.Drawing.Point(438, 78);
			this.textBox1.Name = "textBox1";
			this.textBox1.ReadOnly = true;
			this.textBox1.Size = new Size(214, 22);
			this.textBox1.TabIndex = 33;
			this.label19.AutoSize = true;
			this.label19.Location = new System.Drawing.Point(378, 81);
			this.label19.Name = "label19";
			this.label19.Size = new Size(57, 15);
			this.label19.TabIndex = 32;
			this.label19.Text = "Mã vạch :";
			this.cbbPacket.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.cbbPacket.BackColor = Color.White;
			this.cbbPacket.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbbPacket.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.cbbPacket.FormattingEnabled = true;
			this.cbbPacket.Items.AddRange(new object[]
			{
				"Nam",
				"Nữ"
			});
			this.cbbPacket.Location = new System.Drawing.Point(551, 48);
			this.cbbPacket.Name = "cbbPacket";
			this.cbbPacket.Size = new Size(100, 24);
			this.cbbPacket.TabIndex = 31;
			this.btnSelect.Enabled = false;
			this.btnSelect.Location = new System.Drawing.Point(120, 111);
			this.btnSelect.Name = "btnSelect";
			this.btnSelect.Size = new Size(108, 26);
			this.btnSelect.TabIndex = 16;
			this.btnSelect.Text = "Chọn sản phẩm";
			this.btnSelect.UseVisualStyleBackColor = true;
			this.btnSelect.Click += new EventHandler(this.btnSelect_Click);
			this.btnAddToBill.Enabled = false;
			this.btnAddToBill.Location = new System.Drawing.Point(7, 111);
			this.btnAddToBill.Name = "btnAddToBill";
			this.btnAddToBill.Size = new Size(107, 26);
			this.btnAddToBill.TabIndex = 15;
			this.btnAddToBill.Text = "Thêm sản phẩm";
			this.btnAddToBill.UseVisualStyleBackColor = true;
			this.btnAddToBill.Click += new EventHandler(this.btnAddToBill_Click);
			this.dptProductExpiryDate.CalendarForeColor = Color.Red;
			this.dptProductExpiryDate.CustomFormat = "dd/MM/yyyy";
			this.dptProductExpiryDate.Format = DateTimePickerFormat.Custom;
			this.dptProductExpiryDate.Location = new System.Drawing.Point(274, 79);
			this.dptProductExpiryDate.Name = "dptProductExpiryDate";
			this.dptProductExpiryDate.Size = new Size(100, 21);
			this.dptProductExpiryDate.TabIndex = 14;
			this.label16.AutoSize = true;
			this.label16.ForeColor = Color.Red;
			this.label16.Location = new System.Drawing.Point(204, 82);
			this.label16.Name = "label16";
			this.label16.Size = new Size(67, 15);
			this.label16.TabIndex = 30;
			this.label16.Text = "Hạn dùng :";
			this.dtpProductDate.CustomFormat = "dd/MM/yyyy";
			this.dtpProductDate.Format = DateTimePickerFormat.Custom;
			this.dtpProductDate.Location = new System.Drawing.Point(101, 79);
			this.dtpProductDate.Name = "dtpProductDate";
			this.dtpProductDate.Size = new Size(100, 21);
			this.dtpProductDate.TabIndex = 13;
			this.label15.AutoSize = true;
			this.label15.ForeColor = Color.Red;
			this.label15.Location = new System.Drawing.Point(8, 82);
			this.label15.Name = "label15";
			this.label15.Size = new Size(90, 15);
			this.label15.TabIndex = 28;
			this.label15.Text = "Ngày sản xuất :";
			this.label14.AutoSize = true;
			this.label14.Location = new System.Drawing.Point(506, 53);
			this.label14.Name = "label14";
			this.label14.Size = new Size(41, 15);
			this.label14.TabIndex = 26;
			this.label14.Text = "Số lô :";
			this.txtProductPrice.BackColor = Color.White;
			this.txtProductPrice.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductPrice.Location = new System.Drawing.Point(101, 50);
			this.txtProductPrice.Name = "txtProductPrice";
			this.txtProductPrice.ReadOnly = true;
			this.txtProductPrice.Size = new Size(100, 22);
			this.txtProductPrice.TabIndex = 9;
			this.txtProductPrice.TextAlign = HorizontalAlignment.Right;
			this.txtProductPrice.TextChanged += new EventHandler(this.txtProductPrice_TextChanged);
			this.label13.AutoSize = true;
			this.label13.Location = new System.Drawing.Point(35, 53);
			this.label13.Name = "label13";
			this.label13.Size = new Size(63, 15);
			this.label13.TabIndex = 24;
			this.label13.Text = "Giá nhập :";
			this.txtProductMoney.BackColor = Color.White;
			this.txtProductMoney.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductMoney.Location = new System.Drawing.Point(402, 50);
			this.txtProductMoney.Name = "txtProductMoney";
			this.txtProductMoney.ReadOnly = true;
			this.txtProductMoney.Size = new Size(100, 22);
			this.txtProductMoney.TabIndex = 11;
			this.txtProductMoney.TextAlign = HorizontalAlignment.Right;
			this.txtProductMoney.TextChanged += new EventHandler(this.txtProductMoney_TextChanged);
			this.label12.AutoSize = true;
			this.label12.Location = new System.Drawing.Point(327, 53);
			this.label12.Name = "label12";
			this.label12.Size = new Size(71, 15);
			this.label12.TabIndex = 22;
			this.label12.Text = "Thành tiền :";
			this.txtProductNumber.BackColor = Color.White;
			this.txtProductNumber.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductNumber.Location = new System.Drawing.Point(274, 50);
			this.txtProductNumber.Name = "txtProductNumber";
			this.txtProductNumber.Size = new Size(50, 22);
			this.txtProductNumber.TabIndex = 10;
			this.txtProductNumber.TextAlign = HorizontalAlignment.Right;
			this.txtProductNumber.TextChanged += new EventHandler(this.txtProductNumber_TextChanged);
			this.label11.AutoSize = true;
			this.label11.Location = new System.Drawing.Point(207, 53);
			this.label11.Name = "label11";
			this.label11.Size = new Size(64, 15);
			this.label11.TabIndex = 20;
			this.label11.Text = "Số lượng :";
			this.txtProductUnit.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.txtProductUnit.BackColor = Color.White;
			this.txtProductUnit.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductUnit.Location = new System.Drawing.Point(522, 21);
			this.txtProductUnit.Name = "txtProductUnit";
			this.txtProductUnit.ReadOnly = true;
			this.txtProductUnit.Size = new Size(130, 22);
			this.txtProductUnit.TabIndex = 8;
			this.txtProductUnit.TextChanged += new EventHandler(this.txtProductUnit_TextChanged);
			this.label10.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
			this.label10.AutoSize = true;
			this.label10.Location = new System.Drawing.Point(447, 24);
			this.label10.Name = "label10";
			this.label10.Size = new Size(71, 15);
			this.label10.TabIndex = 18;
			this.label10.Text = "Đơn vị tính :";
			this.txtProductName.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.txtProductName.BackColor = Color.White;
			this.txtProductName.Font = new Font("Arial", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
			this.txtProductName.Location = new System.Drawing.Point(101, 21);
			this.txtProductName.Name = "txtProductName";
			this.txtProductName.ReadOnly = true;
			this.txtProductName.Size = new Size(340, 22);
			this.txtProductName.TabIndex = 7;
			this.txtProductName.TextChanged += new EventHandler(this.txtProductName_TextChanged);
			this.label18.AutoSize = true;
			this.label18.Location = new System.Drawing.Point(5, 24);
			this.label18.Name = "label18";
			this.label18.Size = new Size(93, 15);
			this.label18.TabIndex = 16;
			this.label18.Text = "Tên sản phẩm :";
			this.groupBox3.Controls.Add(this.label25);
			this.groupBox3.Controls.Add(this.label17);
			this.groupBox3.Controls.Add(this.btnSearchTime);
			this.groupBox3.Controls.Add(this.dtpTo);
			this.groupBox3.Controls.Add(this.dtpFrom);
			this.groupBox3.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.groupBox3.Location = new System.Drawing.Point(7, 5);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new Size(220, 107);
			this.groupBox3.TabIndex = 52;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "Tìm kiếm";
			this.label25.AutoSize = true;
			this.label25.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.label25.Location = new System.Drawing.Point(5, 30);
			this.label25.Name = "label25";
			this.label25.Size = new Size(22, 15);
			this.label25.TabIndex = 152;
			this.label25.Text = "Từ";
			this.label17.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
//			this.label17.Image = (Image)componentResourceManager.GetObject("label17.Image");
			this.label17.Location = new System.Drawing.Point(113, 25);
			this.label17.Name = "label17";
			this.label17.Size = new Size(19, 25);
			this.label17.TabIndex = 151;
			this.btnSearchTime.FlatAppearance.BorderColor = Color.Cyan;
			this.btnSearchTime.FlatStyle = FlatStyle.Flat;
			this.btnSearchTime.Location = new System.Drawing.Point(8, 63);
			this.btnSearchTime.Name = "btnSearchTime";
			this.btnSearchTime.Size = new Size(207, 28);
			this.btnSearchTime.TabIndex = 150;
			this.btnSearchTime.Text = "Tìm kiếm hoá đơn";
			this.btnSearchTime.UseVisualStyleBackColor = true;
			this.btnSearchTime.Click += new EventHandler(this.btnSearchTime_Click);
			this.dtpTo.CustomFormat = "dd/MM/yyyy";
			this.dtpTo.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dtpTo.Format = DateTimePickerFormat.Custom;
			this.dtpTo.Location = new System.Drawing.Point(135, 27);
			this.dtpTo.Name = "dtpTo";
			this.dtpTo.Size = new Size(80, 21);
			this.dtpTo.TabIndex = 149;
			this.dtpFrom.CustomFormat = "dd/MM/yyyy";
			this.dtpFrom.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			this.dtpFrom.Format = DateTimePickerFormat.Custom;
			this.dtpFrom.Location = new System.Drawing.Point(29, 27);
			this.dtpFrom.Name = "dtpFrom";
			this.dtpFrom.Size = new Size(80, 21);
			this.dtpFrom.TabIndex = 148;
			this.label20.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.label20.BackColor = SystemColors.ControlLight;
			this.label20.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.label20.Location = new System.Drawing.Point(7, 568);
			this.label20.Name = "label20";
			this.label20.Size = new Size(119, 25);
			this.label20.TabIndex = 53;
			this.label20.Text = "Tổng tiền bán lẻ :  ";
			this.label20.TextAlign = ContentAlignment.MiddleRight;
			this.lblSumMoney.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left);
			this.lblSumMoney.BackColor = Color.FromArgb(255, 255, 192);
			this.lblSumMoney.BorderStyle = BorderStyle.Fixed3D;
			this.lblSumMoney.Font = new Font("Arial", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.lblSumMoney.Location = new System.Drawing.Point(123, 568);
			this.lblSumMoney.Name = "lblSumMoney";
			this.lblSumMoney.Size = new Size(104, 26);
			this.lblSumMoney.TabIndex = 54;
			this.lblSumMoney.Text = "-:-";
			this.lblSumMoney.TextAlign = ContentAlignment.MiddleRight;
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			this.BackColor = Color.White;
			base.ClientSize = new Size(900, 600);
			base.Controls.Add(this.lblSumMoney);
			base.Controls.Add(this.label20);
			base.Controls.Add(this.groupBox3);
			base.Controls.Add(this.groupBox1);
			base.Controls.Add(this.dgvProduct);
			base.Controls.Add(this.btnClose);
			base.Controls.Add(this.btnPrint);
			base.Controls.Add(this.dgvBill);
			base.Controls.Add(this.groupBox2);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 0);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			//base.Icon = (Icon)componentResourceManager.GetObject("$this.Icon");
			base.KeyPreview = true;
			base.Name = "frmLogOutputRetail";
			base.ShowInTaskbar = false;
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "NHẬT KÝ BÁN LẺ";
			base.Load += new EventHandler(this.frmOutputRetail_Load);
			base.KeyDown += new KeyEventHandler(this.frmOutputRetail_KeyDown);
			((ISupportInitialize)this.dgvBill).EndInit();
			((ISupportInitialize)this.dgvProduct).EndInit();
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			this.groupBox2.ResumeLayout(false);
			this.groupBox2.PerformLayout();
			this.groupBox3.ResumeLayout(false);
			this.groupBox3.PerformLayout();
			base.ResumeLayout(false);
		}
		public frmLogOutputRetail()
		{
			this.InitializeComponent();
		}
		private void frmOutputRetail_Load(object sender, EventArgs e)
		{
			this.cbbSex.SelectedIndex = 0;
			this.cusID = this.objCus.getRetailID();
			this.getBill();
		}
		private void btnClose_Click(object sender, EventArgs e)
		{
			base.Close();
		}
		private void frmOutputRetail_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Escape)
			{
				base.Close();
			}
			else
			{
				if (e.KeyCode == Keys.F7)
				{
					this.btnPrint.PerformClick();
				}
			}
		}
		private void getBill()
		{
			this.dgvBill.AutoGenerateColumns = false;
			SqlConnection sqlConnection = new SqlConnection(this.objFunc.strConnectionString);
			string cmdText = "SELECT * FROM [TabBill] WHERE TypeInput = 'OUT4' AND CreateDate BETWEEN @ObjDate1 AND @objDate2 ORDER BY [CreateDate] DESC";
			SqlCommand sqlCommand = new SqlCommand(cmdText, sqlConnection);
			SqlParameter sqlParameter = new SqlParameter("ObjDate1", SqlDbType.DateTime);
			SqlParameter sqlParameter2 = new SqlParameter("ObjDate2", SqlDbType.DateTime);
			sqlParameter.Value = DateTime.Parse(this.dtpFrom.Value.ToString().Substring(0, 10) + " 00:00:00 AM");
			sqlParameter2.Value = DateTime.Parse(this.dtpTo.Value.ToString().Substring(0, 10) + " 11:59:59 PM");
			sqlCommand.Parameters.Add(sqlParameter);
			sqlCommand.Parameters.Add(sqlParameter2);
			SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
			DataSet dataSet = new DataSet();
			sqlConnection.Open();
			sqlDataAdapter.Fill(dataSet);
			this.objTableBill = dataSet.Tables[0];
			this.dgvBill.DataSource = this.objTableBill;
			sqlConnection.Close();
			sqlConnection.Dispose();
			sqlDataAdapter.Dispose();
			dataSet.Dispose();
			try
			{
				this.dgvProduct.Columns["Rate"].Visible = false;
				this.dgvProduct.Columns["PossName"].Visible = false;
			}
			catch
			{
			}
			float num = 0f;
			for (int i = 0; i < this.dgvBill.Rows.Count; i++)
			{
				try
				{
					num += float.Parse(this.dgvBill.Rows[i].Cells["Column10"].Value.ToString());
				}
				catch
				{
				}
			}
			this.lblSumMoney.Text = string.Format(Program.lenAffterDecimal, num);
		}
		private void setStatusBtnAddToBill()
		{
			if (this.txtProductName.Text != "" && this.txtProductUnit.Text != "" && this.txtProductPrice.Text != "" && this.txtProductNumber.Text != "" && this.txtProductMoney.Text != "")
			{
				this.btnAddToBill.Enabled = true;
			}
			else
			{
				this.btnAddToBill.Enabled = false;
			}
		}
		private void resetAllControl()
		{
			this.txtID.Text = "";
			this.txtDate.Value = DateTime.Now;
			this.txtTotalMoney.Text = "0";
			this.txtNote.Text = "";
			this.txtProductNumber.Text = "";
			this.txtProductName.Text = "";
			this.txtProductUnit.Text = "";
			this.txtProductPrice.Text = "";
			this.txtProductMoney.Text = "";
			this.currPid = "";
			this.txtName.Text = "";
			this.txtAge.Text = "";
			this.txtAddress.Text = "";
			this.txtPhone.Text = "";
			this.btnSelect.Focus();
		}
		private void btnPrint_Click(object sender, EventArgs e)
		{
			frmOutputRetailBill.objTable = new DataTable();
			frmOutRetailBillView frmOutRetailBillView = new frmOutRetailBillView();
			frmOutRetailBillView.billID = this.txtID.Text;
			frmOutRetailBillView.billDate = this.txtDate.Text;
			frmOutRetailBillView.billNote = this.txtNote.Text;
			frmOutRetailBillView.billTotalMoney = this.txtTotalMoney.Text;
			frmOutRetailBillView.cusName = this.txtName.Text;
			frmOutRetailBillView.cusAddress = this.txtAddress.Text;
			frmOutRetailBillView.cusPhone = this.txtPhone.Text;
			frmOutRetailBillView.ALl = double.Parse(this.txtTotalMoney.Text).ToString();
			frmOutputRetailBill.objTable = this.objTable;
			frmOutRetailBillView.ShowDialog();
			try
			{
				this.dgvProduct.Columns["TT"].Visible = false;
				this.dgvProduct.Columns["Column24"].Visible = false;
				this.dgvProduct.Columns["Column25"].Visible = false;
			}
			catch
			{
			}
			this.objBill.setPrinted(this.txtID.Text);
		}
		private void btnDel_Click(object sender, EventArgs e)
		{
			if (MessageBox.Show("Bạn có chắc chắn muốn xoá hoá đơn [ " + this.txtID.Text.ToUpper() + " ] không?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
			{
				this.objBill.delItem(this.txtID.Text);
				this.getBill();
				this.dgvProduct.DataSource = null;
			}
		}
		private void btnSelect_Click(object sender, EventArgs e)
		{
			frmSelectProduct frmSelectProduct = new frmSelectProduct();
			frmSelectProduct.ShowDialog();
			if (frmSelectProduct.productID != "")
			{
				this.currPid = frmSelectProduct.productID;
				this.txtProductName.Text = frmSelectProduct.productName;
				this.txtProductUnit.Text = frmSelectProduct.unitName;
				this.txtProductPrice.Text = frmSelectProduct.priceTrade;
				this.txtProductNumber.Focus();
			}
		}
		private void btnAddToBill_Click(object sender, EventArgs e)
		{
			if (this.txtProductNumber.Text == "")
			{
				MessageBox.Show("Nhập vào số lượng sản phẩm cần nhập hàng", "Cảnh báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				this.txtProductNumber.Focus();
			}
			else
			{
				int num = this.checkInObjTable(this.currPid);
				if (num == -1)
				{
					this.objTable.Rows.Add(new object[]
					{
						this.currPid,
						this.txtProductName.Text,
						this.txtProductUnit.Text,
						this.txtProductNumber.Text,
						this.txtProductPrice.Text,
						this.txtProductMoney.Text,
						this.cbbPacket.Text,
						this.dtpProductDate.Text,
						this.dptProductExpiryDate.Text
					});
					this.dgvProduct.Refresh();
					this.txtTotalMoney.Text = string.Format(Program.lenAffterDecimal, this.checkMoneyOfBill());
				}
				else
				{
					this.updateObjTable(num);
					this.txtTotalMoney.Text = string.Format(Program.lenAffterDecimal, this.checkMoneyOfBill());
				}
				this.resetControl();
			}
		}
		private int checkInObjTable(string Pid)
		{
			int num = -1;
			int result;
			for (int i = 0; i < this.objTable.Rows.Count; i++)
			{
				if (this.objTable.Rows[i]["Pid"].ToString() == Pid)
				{
					num = i;
					result = num;
					return result;
				}
			}
			result = num;
			return result;
		}
		private double checkMoneyOfBill()
		{
			double num = 0.0;
			for (int i = 0; i < this.objTable.Rows.Count; i++)
			{
				num += double.Parse(this.objTable.Rows[i]["ProductMoney"].ToString());
			}
			return num;
		}
		private void updateObjTable(int index)
		{
			this.objTable.Rows[index]["Pid"] = this.currPid;
			this.objTable.Rows[index]["ProductName"] = this.txtProductName.Text;
			this.objTable.Rows[index]["ProductUnit"] = this.txtProductUnit.Text;
			this.objTable.Rows[index]["ProductPrice"] = this.txtProductPrice.Text;
			this.objTable.Rows[index]["ProductNumber"] = this.txtProductNumber.Text;
			this.objTable.Rows[index]["ProductMoney"] = this.txtProductMoney.Text;
			this.objTable.Rows[index]["Packet"] = this.cbbPacket.Text;
			this.objTable.Rows[index]["ProductDate"] = this.dtpProductDate.Text;
			this.objTable.Rows[index]["ProductExpiryDate"] = this.dptProductExpiryDate.Text;
		}
		private void resetControl()
		{
			this.txtProductNumber.Text = "";
			this.txtProductName.Text = "";
			this.txtProductUnit.Text = "";
			this.txtProductPrice.Text = "";
			this.txtProductMoney.Text = "";
			this.currPid = "";
		}
		private void txtProductName_TextChanged(object sender, EventArgs e)
		{
			this.cbbPacket.DataSource = null;
			this.objFunc.LoadComboBox("SELECT DISTINCT [Packet] FROM [TabDetailBill] WHERE [Pid] = " + this.currPid, this.cbbPacket, "Packet", "Packet");
			this.setStatusBtnAddToBill();
		}
		private void txtProductUnit_TextChanged(object sender, EventArgs e)
		{
			this.setStatusBtnAddToBill();
		}
		private void txtProductPrice_TextChanged(object sender, EventArgs e)
		{
			this.setStatusBtnAddToBill();
		}
		private void txtProductNumber_TextChanged(object sender, EventArgs e)
		{
			double num = 0.0;
			if (this.txtProductNumber.Text != "")
			{
				try
				{
					num = double.Parse(this.txtProductNumber.Text);
				}
				catch
				{
					num = 0.0;
				}
				if (this.txtProductPrice.Text != "")
				{
					this.txtProductMoney.Text = string.Format(Program.lenAffterDecimal, num * double.Parse(this.txtProductPrice.Text));
				}
			}
			this.setStatusBtnAddToBill();
		}
		private void txtProductMoney_TextChanged(object sender, EventArgs e)
		{
			this.setStatusBtnAddToBill();
		}
		private void dgvBill_CellEnter(object sender, DataGridViewCellEventArgs e)
		{
			this.txtID.Text = this.objTableBill.Rows[e.RowIndex]["ID"].ToString();
			this.txtDate.Value = DateTime.Parse(this.objTableBill.Rows[e.RowIndex]["CreateDate"].ToString());
			this.txtTotalMoney.Text = this.objTableBill.Rows[e.RowIndex]["TotalMoney"].ToString();
			this.txtNote.Text = this.objTableBill.Rows[e.RowIndex]["Note"].ToString();
			this.txtName.Text = this.objTableBill.Rows[e.RowIndex]["_Name"].ToString();
			this.txtAge.Text = this.objTableBill.Rows[e.RowIndex]["_Age"].ToString();
			this.cbbSex.SelectedValue = this.objTableBill.Rows[e.RowIndex]["_Sex"].ToString();
			this.txtAddress.Text = this.objTableBill.Rows[e.RowIndex]["_Address"].ToString();
			this.txtPhone.Text = this.objTableBill.Rows[e.RowIndex]["_Phone"].ToString();
			this.objTable = new DataTable();
			this.objTable = this.objBill.getDetailBill(this.txtID.Text);
			this.dgvProduct.DataSource = this.objTable;
			this.dgvProduct.Refresh();
			this.txtID.ReadOnly = true;
			this.btnSelect.Enabled = false;
			this.btnAddToBill.Enabled = false;
			this.txtProductNumber.ReadOnly = true;
			this.cbbPacket.Enabled = false;
			this.btnPrint.Enabled = true;
			this.txtName.ReadOnly = true;
			this.txtAge.ReadOnly = true;
			this.txtAddress.ReadOnly = true;
			this.txtPhone.ReadOnly = true;
			this.txtNote.ReadOnly = true;
			this.cbbSex.Enabled = false;
			this.resetControl();
		}
		private void dgvProduct_CellEnter(object sender, DataGridViewCellEventArgs e)
		{
			try
			{
				if (e.RowIndex != -1)
				{
					this.currPid = this.objTable.Rows[e.RowIndex]["Pid"].ToString();
					this.txtProductName.Text = this.objTable.Rows[e.RowIndex]["ProductName"].ToString();
					this.txtProductUnit.Text = this.objTable.Rows[e.RowIndex]["ProductUnit"].ToString();
					this.txtProductPrice.Text = this.objTable.Rows[e.RowIndex]["ProductPrice"].ToString();
					this.txtProductNumber.Text = this.objTable.Rows[e.RowIndex]["ProductNumber"].ToString();
					this.txtProductMoney.Text = this.objTable.Rows[e.RowIndex]["ProductMoney"].ToString();
					this.cbbPacket.SelectedValue = this.objTable.Rows[e.RowIndex]["Packet"].ToString();
					this.dtpProductDate.Value = DateTime.Parse(this.dgvProduct.Rows[e.RowIndex].Cells["Column7"].Value.ToString());
					this.dptProductExpiryDate.Value = DateTime.Parse(this.dgvProduct.Rows[e.RowIndex].Cells["Column8"].Value.ToString());
					this.btnAddToBill.Enabled = true;
				}
			}
			catch
			{
			}
		}
		private void dtpSelectMonth_ValueChanged(object sender, EventArgs e)
		{
			this.getBill();
		}
		private void btnSearchTime_Click(object sender, EventArgs e)
		{
			this.getBill();
		}
	}
}
